package client.comm.baoding.adapter

import android.content.Context
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import client.comm.commlib.base.BaseAdapter
import client.comm.commlib.base.BindingViewHoder
import client.comm.baoding.R
import client.comm.baoding.databinding.LayoutSearchitemBinding

class SearchAdapter(context: Context) : BaseAdapter<String>(context) {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        return BindingViewHoder(
            DataBindingUtil.inflate(
                layoutInflater,
                R.layout.layout_searchitem,
                parent,
                false
            )
        )
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        val binding = (holder as BindingViewHoder<LayoutSearchitemBinding>).binding
        val item = getItem(position)
        binding.tv.text = item
    }
}